package com.kk.test.service.impl;

import com.kk.test.entity.Booklimit;
import com.kk.test.mapper.BooklimitMapper;
import com.kk.test.service.BooklimitService;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;

import java.util.List;

/**
 * 图书表（分页）(Booklimit)表服务实现类
 *
 * @author makejava
 * @since 2025-05-02 23:07:15
 */
@Service("booklimitService")
public class BooklimitServiceImpl implements BooklimitService {
    @Resource
    private BooklimitMapper booklimitMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Booklimit queryById(Integer id) {
        return this.booklimitMapper.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param booklimit 筛选条件
     * @return 查询结果
     */
    @Override
    public List<Booklimit> queryByPage(Booklimit booklimit) {
        return null;
    }

    /**
     * 新增数据
     *
     * @param booklimit 实例对象
     * @return 实例对象
     */
    @Override
    public Booklimit insert(Booklimit booklimit) {
        this.booklimitMapper.insert(booklimit);
        return booklimit;
    }

    /**
     * 修改数据
     *
     * @param booklimit 实例对象
     * @return 实例对象
     */
    @Override
    public Booklimit update(Booklimit booklimit) {
        this.booklimitMapper.update(booklimit);
        return this.queryById(booklimit.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.booklimitMapper.deleteById(id) > 0;
    }
}
